import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/Home.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home,
    },
    {
      path: '/category',
      name: 'Category',
      component: () => import('@/views/Category.vue'),
      meta: {
        navBar: true,
        title: '分类'
      }
    },
    {
      path: '/cart',
      name: 'Cart',
      component: () => import('@/views/Cart.vue'),
    },
    {
      path: '/user',
      name: 'User',
      component: () => import('@/views/User.vue'),
    },
    {
      path: '/register',
      name: 'Register',
      component: () => import('@/views/Register.vue'),
      meta: {
        title: '注册',
        keepAlive: false,
        tabBar: false,
        navBar: false
      }
    },
    {
      path: '/login',
      name: 'Login',
      component: () => import('@/views/Login.vue'),
      meta: {
        title: '登录',
        keepAlive: false,
        tabBar: false,
        navBar: false
      }
    },
    {
      path: '/rpwd',
      name: 'Rpwd',
      component: () => import('@/views/Rpwd.vue'),
      meta: {
        title: '修改密码',
        keepAlive: false,
        tabBar: true,
        navBar: true,
        requireAuth: true
      }
    },
    {
      path: '/nullPage',
      name: 'NullPage',
      component: () => import('@/views/NullPage.vue'),
      meta: {
        title: '404',
        keepAlive: false,
        tabBar: true,
        navBar: false,
        requireAuth: true
      }
    },
  ],
})

export default router
